package com.blog.quartzTest;

import com.blog.util.DateFormatUtil;
import org.assertj.core.util.DateUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.Date;
import java.util.StringJoiner;

/**
 * @author cgx
 * @Date 2021/11/19 16:52
 */
public class helloQuartz implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        StringJoiner stringJoiner = new StringJoiner("   ")
                .add("开始任务")
                .add(DateFormatUtil.dataToStrLong(new Date()))
                .add(Thread.currentThread().getName())
                .add(jobExecutionContext.getTrigger().getKey().getName());

        System.err.println(stringJoiner);
    }
}
